﻿using System.Collections.Generic;
using Microsoft.Data.Schema.ScriptDom.Sql;
using System.IO;
using System.Collections.ObjectModel;

namespace Neznayka
{
    internal class ParameterDeclarationVisitor : TSqlConcreteFragmentVisitor
    {
        private List<ProcedureParameter> _targets;

        #region ctor
        public ParameterDeclarationVisitor()
        {
            _targets = new List<ProcedureParameter>();
        }
        #endregion

        #region properties
        public ReadOnlyCollection<ProcedureParameter> ParameterDeclarations
        {
            get { return _targets.AsReadOnly(); }
        }
        #endregion

        #region overrides
        public override void ExplicitVisit(AlterFunctionStatement node)
        {
            foreach ( var p in node.Parameters){
                _targets.Add(p);
            }
        }
        public override void ExplicitVisit(CreateFunctionStatement node)
        {
            foreach (var p in node.Parameters)
            {
                _targets.Add(p);
            }
        }
        public override void ExplicitVisit(AlterProcedureStatement node)
        {
            foreach (var p in node.Parameters)
            {
                _targets.Add(p);
            }
        }
        public override void ExplicitVisit(CreateProcedureStatement node)
        {
            foreach (var p in node.Parameters)
            {
                _targets.Add(p);
            }
        }
        #endregion

    }


}